/*
 * Copyright (c) 2016. zhaojin 15398699939@163.com
 */

package com.bankscene.screenfit.vus;

import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bankscene.screenfit.R;
import com.bankscene.screenfit.model.Menus;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * Created by jiiiiiin on 6/14/16.
 */
public class MenusListViewItemVu extends BaseVu implements Vu {

    @BindView(R.id.icon)
    ImageView icon;
    @BindView(R.id.title)
    TextView titleView;

    @Override
    public void init(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable EventBus bus) {
        this.bus = bus;
        rootView = inflater.inflate(R.layout.menuslistview_item, container, false);
        unbinder = ButterKnife.bind(this, rootView);
    }

    @Override
    public View getRootView() {
        return rootView;
    }

    public void setTitle(@NonNull String title) {
        titleView.setText(title);
    }

    public void setVal(@NonNull Menus val) {
        icon.setImageResource(val.getIcon());
        titleView.setText(val.getTitle());
    }

    @CheckResult
    public TextView getTitleView() {
        return titleView;
    }
}
